(in-package :lilu-swank-client)

(defun eval-script (code &key (debugger nil))
  (swank::with-io-redirection (swank::*emacs-connection*)
    ;;(swank:init-presentations)
    ;;(swank-repl:create-repl NIL :CODING-SYSTEM "utf-8-unix")
    (lilu-debugger:enable-debugger)
    (let ((*package* (find-package 'lilu-swank-client-user))
          (stream (make-string-input-stream code)))
      (loop for line = (read stream nil)
            while line
            collect
           (lilu-debugger:with-debugger (debugger)
             (format nil "~s" (eval line)))))))
